<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\signup\controller;

use plugin\saiadmin\basic\BaseController;
use app\signup\logic\signupLogic;
use app\signup\validate\signupValidate;
use support\Request;
use support\Response;

/**
 * 报名列表控制器
 */
class signupController extends BaseController
{
    /**
     * 数据表主键
     */
    protected $pk = 'signup_id';
    
    /**
     * 构造函数
     */
    public function __construct()
    {
        $this->logic = new signupLogic();
        $this->validate = new signupValidate;
        parent::__construct();
    }

    /**
     * 数据列表
     * @param Request $request
     * @return Response
     */
    public function index(Request $request): Response
    {
        $where = $request->more([
            ['activity_id', ''],
            ['member_name', ''],
            ['sex', ''],
            ['phone_number', ''],
            ['company_name', ''],
            ['company_position', ''],
            ['signup_time', ''],
        ]);
        $query = $this->logic->search($where) ->order('create_time desc');
        $data = $this->logic->getList($query);
        return $this->success($data);
    }
  public function export(Request $request) : Response
    {
       
         $where = $request->more([
            ['activity_id', ''],
            ['member_name', ''],
            ['sex', ''],
            ['phone_number', ''],
            ['company_name', ''],
            ['company_position', ''],
            ['signup_time', '']
        ]);
        return $this->logic->export($where);
    }
}
